<template>
  <a-modal :maskClosable="false"
    :title="title"
    :width="1248"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭">
    <a-spin :spinning="confirmLoading">

      <a-form-model ref="form" v-bind="layout" :model="model">
        <a-row>
          <a-col span="12">
            <a-form-model-item label="本次随访开始时间" v-if="model.planType=='1'">
              <a-date-picker showTime format="YYYY-MM-DD HH:mm:ss" valueFormat="YYYY-MM-DD HH:mm:ss"
                             v-model="model.signIn" />
            </a-form-model-item>
          </a-col>
          <a-col span="12">
            <a-form-model-item label="本次随访结束时间" v-if="model.planType=='1'">
              <a-date-picker showTime format="YYYY-MM-DD HH:mm:ss" valueFormat="YYYY-MM-DD HH:mm:ss"
                             v-model="model.signOut" />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col span="12">
            <a-form-model-item label="致电时间" v-if="model.planType=='2'">
              <a-date-picker showTime format="YYYY-MM-DD HH:mm:ss" valueFormat="YYYY-MM-DD HH:mm:ss"
                             v-model="model.signIn" />
            </a-form-model-item>
          </a-col>
          <a-col span="12">
          </a-col>
        </a-row>
        <a-row>
          <a-col span="12">
            <a-form-model-item label="计划下次执行日期" v-if="model.qty-1>0">
              <a-date-picker showTime format="YYYY-MM-DD" valueFormat="YYYY-MM-DD"
                             v-model="model.nextTime" />
            </a-form-model-item>
          </a-col>
          <a-col span="12">

          </a-col>
        </a-row>
        <a-row>
          <a-col span="12">
            <a-form-model-item label="运动情况(分钟/次)" >
              <a-input-number v-model="model.sportsSituation" style="width: 150px"></a-input-number>
            </a-form-model-item>
          </a-col>
          <a-col span="12">
            <a-form-model-item label=" 每周运动情况(次/周)">
               <a-input-number v-model="model.weekSportsSituation"  style="width: 150px"></a-input-number>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col span="12">
            <a-form-model-item label="摄盐情况">
              <a-select v-model='model.saltSituation' placeholder='请选择摄盐情况'>
                <a-select-option value=''>请选择</a-select-option>
                <a-select-option value='轻'>轻</a-select-option>
                <a-select-option value='中'>中</a-select-option>
                <a-select-option value='重'>重</a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col span="12">
            <a-form-model-item label="心理调整" >
              <a-select v-model='model.psychologicalAdjust' placeholder='请选择心理调整'>
                <a-select-option value=''>请选择</a-select-option>
                <a-select-option value='良好'>良好</a-select-option>
                <a-select-option value='一般'>一般</a-select-option>
                <a-select-option value='差'>差</a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
        </a-row>

        <a-row>
          <a-col span="12">
            <a-form-model-item label="遵医行为">
              <a-select v-model='model.complianceBehavior' placeholder='请选择遵医行为'>
                <a-select-option value=''>请选择</a-select-option>
                <a-select-option value='良好'>良好</a-select-option>
                <a-select-option value='一般'>一般</a-select-option>
                <a-select-option value='差'>差</a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col span="12">
            <a-form-model-item label="服药依从性" >
              <a-select v-model='model.medicationCompliance' placeholder='请选择服药依从性'>
                <a-select-option value=''>请选择</a-select-option>
                <a-select-option value='规律'>规律</a-select-option>
                <a-select-option value='间断'>间断</a-select-option>
                <a-select-option value='不服从'>不服从</a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col span="12">
            <a-form-model-item label="精神状态" v-if="model.planType=='1'">
              <a-select  v-model='model.mentality' placeholder='请选择摄盐情况'  mode="multiple">
                <a-select-option value=''>请选择</a-select-option>
                <a-select-option value='清醒与警觉'>清醒与警觉</a-select-option>
                <a-select-option value='轻度混乱'>轻度混乱</a-select-option>
                <a-select-option value='嗜睡'>嗜睡</a-select-option>
                <a-select-option value='思维障碍'>思维障碍</a-select-option>
                <a-select-option value='注意障碍'>注意障碍</a-select-option>
                <a-select-option value='记忆障碍'>记忆障碍</a-select-option>
                <a-select-option value='智能障碍'>智能障碍</a-select-option>
                <a-select-option value='定向力障碍'>定向力障碍</a-select-option>
                <a-select-option value='情感障碍'>情感障碍</a-select-option>
                <a-select-option value='动作行为障碍'>动作行为障碍</a-select-option>
                <a-select-option value='意志障碍'>意志障碍</a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col span="12">
            <a-form-model-item label="随访分类" v-if="model.planType=='1'">
              <a-select v-model='model.followUpSituation' placeholder='请选择心理调整'>
                <a-select-option value=''>请选择</a-select-option>
                <a-select-option value='控制满意'>控制满意</a-select-option>
                <a-select-option value='控制不满意'>控制不满意</a-select-option>
                <a-select-option value='不良反应'>不良反应</a-select-option>
                <a-select-option value='并发症'>并发症</a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row justify="start">
          <a-form-model-item label="随访记录" :label-col="{span: 3 }" :wrapperCol="{span: 20 }">
            <a-textarea style="height: 100px" v-model="model.recordContent" />
          </a-form-model-item>
        </a-row>
        <a-row justify="start">
          <a-form-model-item label="指导意见" :label-col="{span: 3 }" :wrapperCol="{span: 20 }">
            <a-textarea style="height: 100px" v-model="model.doctorGuidance" />
          </a-form-model-item>
        </a-row>
      </a-form-model>
    </a-spin>
  </a-modal>
</template>

<script>
import { httpAction, putAction, getAction, postAction } from '@api/manage'
import { pushIfNotExist } from '@/utils/util'
import EmployeeDialog from '@views/his/dialog/EmployeeDialog'

export default {
  name: 'HHisInterviewPlanExecModal',
  components: {
    EmployeeDialog
  },
  data() {
    return {
      title: '操作',
      visible: false,
      layout: {
        labelCol: { span: 6 },
        wrapperCol: { span: 14 }
      },
      confirmLoading: false,
      url: {
        list: '/ch/interview/log/list'
      },
      model: {}
    }
  },

  created() {
    this.modelDefault = JSON.parse(JSON.stringify(this.model))
  },
  methods: {
    edit(record) {
      this.model = Object.assign({}, record)
      this.visible = true
    },
    close() {
      this.$emit('close')
      this.visible = false
    },
    handleOk() {
      const that = this
      postAction('/ch/interview/detail/exec', this.model).then((res) => {
        if (res.success) {
          that.$message.success(res.message)
          that.$emit('ok')
          that.close()
        } else {
          that.$message.warning(res.message)
        }
      }).finally(() => {
      })
    },
    handleCancel() {
      this.close()
    }
  }
}
</script>

<style scoped>

</style>